package com.ksp.wke.kspa05;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;

import javax.servlet.ServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ksp.dom.KSPDOM_ResDta;

import net.minidev.json.JSONArray;

@Controller
public class KSPA05Controller {

	private AtomicInteger totoal = new AtomicInteger(0);
	@Autowired
	private KSPA05Mapper kspa05Mapper;

	@RequestMapping("/art/KSPA05")
	@ResponseBody
	public KSPDOM_ResDta iniPam(ServletRequest request) {
		String wTtlTch = request.getParameter("TTL_TCH");
		
		Map<String, Object> wPamMap = new HashMap<>();
		wPamMap.put("TTL_TCH", wTtlTch);
		KSPDOM_ResDta wResDta = new KSPDOM_ResDta();
		SimpleDateFormat sfd = new SimpleDateFormat("yyyyMMdd HH:mm:ss");
		totoal.incrementAndGet();
		System.out.println("主线程A05开始：" + sfd.format(new Date())+ "总数：" + totoal);
		try {
			wResDta = exeSrv(wPamMap);
		} catch (Exception e) {
			wResDta.setCod("400");
			wResDta.setMsg(e.getMessage());
		}
		System.out.println("主线程A05结束：" + sfd.format(new Date()) + "\n");
		return wResDta;
	}

	public KSPDOM_ResDta exeSrv(Map<String, Object> pPamMap) {
		//List<Map<String, Object>> wQryQuaLst = kspa05Mapper.qryQuaLst(pPamMap);
		kspa05Mapper.updArtScnCnt(pPamMap);
		
		return KSPDOM_ResDta.buildSucc("");
	}
}
